<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: haojianlei
  Date: 2018-11-23
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/assets/shipui/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/shipui/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/shipui/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/shipui/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/ship/ship.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/layui/css/layui.css"  media="all">
    <link href="${pageContext.request.contextPath}/assets/shipui/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <style>
        .shipClassText{
            margin-right:5px;
            color: #1c84c6 !important;
            cursor: pointer;
            margin-left: 5px;
        }
        .shipClassText:hover{
            color: #1847c6 !important;
        }
        .shipClassTextDelete{
            margin-right:5px;
            color: #ff654f !important;
            cursor: pointer;
            margin-left: 5px;
        }
        .shipClassTextDelete:hover{
            color: #c62e1d !important;
        }
        .pay-fee-ship{
            position: relative;
            display: inline-block;
            width:150px;
            height: 100px;
            cursor: pointer;
        }

        .month{
            margin-left: 25px;
            background: url(${pageContext.request.contextPath}/assets/img/login/fee_1month.png) no-repeat center center;
            background-size:cover;
        }
        .year{
            margin-left: 25px;
            background: url(${pageContext.request.contextPath}/assets/img/login/fee_40year.png) no-repeat center center;
            background-size:cover;
        }
        .pay-fee-click{
            border: 1px solid #0095d9;
        }
        .pay-fee-click .check-active2{
            position: absolute;
            bottom: 0px;
            right: 0px;
            display: block;
            width:15px;
            height: 15px;
            background: url(${pageContext.request.contextPath}/assets/img/login/check_icon2.png) no-repeat center center;
        }
    </style>


</head>

<body class="gray-bg">
<div class="row wrapper border-bottom white-bg page-heading" style="padding: 0px 20px 10px">
    <div class="row" style="margin-top: 20px">
        <div class="col-sm-4" style="margin-left: 16px">
            <ol class="breadcrumb">
                <li>
                    <a href="toShipHome.do">运力管理</a>
                </li>
                <li>
                    <strong data-toggle="modal">自有运力</strong>
                </li>
            </ol>
        </div>
        <div class="col-sm-8">
            <%--备用--%>
        </div>
    </div>

    <div class="row" style="margin-top: 50px">
        <div class="col-xs-12 col-sm-10">
            <div class="row">
                <div class="col-xs-3">
                    <label style="width:120px;font-size:16px;margin-left: 16px;margin-top:5px">搜索运力</label>
                </div>
                <div class="col-xs-12 col-sm-9">
                            <input type="hidden" id="page" value="1">
                            <div class="col-xs-3 layui-col-sm3">
                                <div class="layui-input-inline">
                                    <input type="text" name="shipName" id="shipName" lay-verify="required" autocomplete="off" placeholder="请输入船名" class="form-control" style="margin-left: 5px">
                                </div>
                            </div>
                            <div class="col-xs-8 layui-col-sm8">
                                <label class="layui-form-label" style="width:100px;">吨位区间</label>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="startTon" id="startTon" lay-verify="required" autocomplete="off" class="form-control">
                                </div>
                                <div class="layui-input-inline" style="width: 20px;">—</div>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="endeTon" id="endTon" lay-verify="required" autocomplete="off" class="form-control">
                                </div>
                                <div class="layui-input-inline " style="width: 90px;margin-left: 10px;">
                                    <span class="shipTabText">
                                        <a href="#allShip" type="button" data-toggle="tab" id="searchShipButton" class="btn btn-primary" onclick="allShips($('#page').val())">
                                       搜索船舶
                                    </a>
                                    </span>
                                </div>
                            </div>
                </div>
            </div>
        </div>
        <div class="col-xs-10 col-sm-2" >
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addShip">添加运力</button>
            <%--添加承运船舶--%>
            <div class="modal fade" id="addShip" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width:80%;">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h3 class="modal-title">
                                船舶运力信息
                            </h3>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <div class="row" style="margin-left: 5px;margin-bottom: 10px;">
                                    <div class="btn-group" data-toggle="buttons">
                                        <input type="radio" id="radioShipName" name="options" value="0" checked="checked">船舶名称
                                        <input type="radio" id="radioMmsi" name="options" value="1">MMSI
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-4">
                                        <input type="text" id="shipNames" class="form-control" placeholder="请输入完整船舶名称">
                                        <input type="text" id="mmsi" class="form-control" placeholder="请输入船舶mmsi" style="display: none">
                                    </div>
                                    <div class="col-md-2 pull-left">
                                        <button class="btn btn-primary" type="button" id="modalSearchButton" onclick="selectAllShipsByShipName()">搜索船舶</button>
                                    </div>
                                    <div class="col-md-offset-4 col-md-2 pull-right">
                                        <button class="btn btn-primary" id="addBtn" type="button" data-toggle="modal" data-target="#addShipInfo" style="display:none;" onclick="addValue()">添加船舶</button>
                                    </div>
                                </div>
                            </div>
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>船名</th>
                                    <th>实时位置</th>
                                    <th>实时吨位</th>
                                    <th>航行状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="tbody"></tbody>
                            </table>
                        </div>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
            <button class="btn btn-primary" type="submit" onclick="window.location.href='toImportShip.do'">导入运力</button>
        </div>
    </div>
    <div class="modal fade" id="addClassification" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:30%;">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="form-group" style="text-align: center">
                        <label for="classificationName">运力分类名称</label>
                        <input type="text" class="form-control" id="classificationName" style="width: 80%;margin-top: 30px;margin-left: 10%" placeholder="请输入运力分类名称">
                    </div>
                    <div class="form-group" style="margin-left: 35%;">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="addClassification()">提交</button>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>


    <div class="modal fade" id="addShipInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:30%;">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="classificationName">船舶名称</label>
                        <input type="text" class="form-control" id="shipName_1"   style="width: 80%" placeholder="请输入船舶名称">
                    </div>
                    <div class="form-group">
                        <label for="classificationName">MMSI</label>
                        <input type="text" class="form-control" id="mmsi_1"  style="width: 80%" placeholder="请输入MMSI">
                    </div>
                    <div class="form-group">
                        <label for="classificationName">吨位</label>
                        <input type="text" class="form-control" id="tonnage" style="width: 80%" placeholder="请输入吨位">
                    </div>
                    <div class="form-group">
                        <label for="classificationName">船主名称</label>
                        <input type="text" class="form-control" id="shipOwnerName" style="width: 80%" placeholder="请输入船主名称">
                    </div>
                    <div class="form-group">
                        <label for="classificationName">联系电话</label>
                        <input type="text" class="form-control" id="phoneNum" style="width: 80%" placeholder="请输入联系电话">
                    </div>
                    <div class="form-group">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="addShipInfo()">提交</button>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>

    <%--航行日志模态框--%>
    <div class="modal fade" id="sailingLogModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:30%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h3 class="modal-title">
                        航行日志
                    </h3>
                </div>
                <div class="modal-body" id="item">

                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
    <%--end--%>


<%--扣费模态框--%>
    <div class="modal fade" id="shipAndUser" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:30%;">
            <div class="modal-content">
                <div class="modal-header" style="background-color: #0d8ddb;color: white">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" >
                        <h3>选择计费模式</h3>
                    </div>
                </div>
                <div class="modal-body" style="text-align: center">
                    <input type="hidden" id="shipId"value=""/>
                    <input type="hidden" id="consumeId"value=""/>

                    <div class="row">
                        <input type="radio" name="time" value="3" id="year"  style="display:none" onclick="addOrdernumber()"/><label  class="pay-fee-ship year"  for="year"><i class="check-active2"></i></label>
                        <input type="radio" name="time"  value="2" id="month" style="display:none" onclick="addOrdernumber()"/><label class="pay-fee-ship month"  for="month"><i class="check-active2"></i></label>
                    </div>

                    <%--<input type="radio" id="month" name="time" value="2" onclick="addOrdernumber()"/><label for="month">按月扣费(5元/船/月)</label>--%>
                    <%--<input type="radio" value="3" id="year" name="time" onclick="addOrdernumber()"/><label for="year">按年扣费（40元/船/年）</label>--%>

                    <div class="modal-footer" style="text-align: center;margin-top: 15px">
                        <div class="form-group">
                            <div class="row" >
                                <%--<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>--%>
                                <button type="button" class="btn btn-primary" style="width: 220px" onclick="addUserAndShip()">提交</button>
                            </div>

                        </div>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>

    <%--end--%>



    <%--航行轨迹模态框--%>
    <div class="modal fade" id="shipTrackModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:80%;height: 500px">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title">
                        <div class="col-sm-3">
                            <input type="hidden" id="trackMmsi" value="">
                            <input type="text" class="form-control" name="ordernumber" id="timeSearch" placeholder="请选择时间范围"
                                   value="">
                        </div>
                        <div class="col-sm-2">
                            <button type="button" class="btn btn-primary"
                                    onclick="shipTrack($('#trackMmsi').val())">筛选航行轨迹
                            </button>
                        </div>
                    </div>
                </div>
                <div class="modal-body" style="padding:0">
                    <div id="container" style="width:100%;height:500px"></div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>

    <%--end--%>



 <%--运力模态框--%>

    <div class="modal fade" id="addShipNotClassificationShip" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:80%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h3 class="modal-title">
                        船舶运力信息
                    </h3>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="row">
                            <div class="col-md-4">
                                <input type="text" class="form-control" id="classShipName" style="width: 80%" placeholder="请输入船舶名称">
                            </div>
                            <div class="col-md-2 pull-left">
                                <button class="btn btn-primary" type="button"  onclick="selectNotClassificationShips($('#page').val(),$('#classification').val())">搜索船舶</button>
                            </div>
                        </div>
                    </div>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>船名</th>
                            <th>实时位置</th>
                            <th>实时吨位</th>
                            <th>航行状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="tbodyNotClassificationShip"></tbody>
                    </table>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="col-md-2">
                                <select id="limitNotClassificationShip" name="limitNotClassificationShip">
                                    <option value="10">10条/页</option>
                                    <option value="20">20条/页</option>
                                    <option value="30">30条/页</option>
                                    <option value="40">40条/页</option>
                                    <option value="50">50条/页</option>
                                </select>
                            </div>
                            <span id="summaryNotClassificationShip"></span>
                        </div>
                        <div class="col-md-6" style="text-align: right">
                            <input type="hidden" id="pagenumNotClassificationShip"/>
                            <input type="hidden" id="pagesizeNotClassificationShip"/>
                            <ul id="paginationNotClassificationShip" class="pagination">
                                <li id="homePageNotClassificationShip"><a href="#" class="btn btn-default" style="height:26px">首页</a></li>
                                <li id="previousPageNotClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height:26px">上一页</a></li>
                                <li id="nextPageNotClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height:26px">下一页</a></li>
                                <li id="tailPageNotClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height:26px">最后一页</a></li>
                                <li>跳转至<input id='pageNotClassificationShip' name='pages' type='text'size="6"/>页<input type='button' value='GO' onclick='selectNotClassificationShips($("#pageNotClassificationShip").val(),$("#classification").val())'/></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
    <div id="myTab" class="layui-row" style="margin-top: 30px;margin-left:-5px;">
        <input type="hidden" id="classification"/>
        <span class="shipTabText  shipTabText-click" id="shipTabText" style="font-size: 16px"><a href="#allShip" data-toggle="tab" onclick="allShips($('#page').val())">全部运力</a></span>
        <span class="shipTabText" style="font-size: 16px;margin-left: 20px"><a href="#canVideo" data-toggle="tab" onclick="allShipsByMonitoring($('#page').val(),1)" >可监控</a></span>
        <span class="shipTabText" style="font-size: 16px;margin-left: 20px"><a href="#authed" data-toggle="tab" onclick="allShipsByCertified($('#page').val(),1)">已认证</a></span>
        <span class="shipTabText" style="font-size: 16px;margin-left: 20px"><a href="#authing" data-toggle="tab" onclick="allShipsByCertification($('#page').val(),0)">人工认证中</a></span>
        <span style="font-size: 16px;margin-left: 20px">|</span>
        <span id="ylClassification">|</span>
        <span class="shipTabAdd"  style="font-size: 16px;margin-left: 20px;color: #0d8ddb"><a class="shipAddClass" style="height: 36px;color: #0d8ddb" data-toggle="modal" data-target="#addClassification">+添加分类</a></span>
        <%--<span class="deleteClassification" id="deleteClassification" style="font-size: 16px;margin-left: 20px;display: none"><a class="shipAddClass" style="height: 36px;color: red" onclick="deleteClassification()">删除分类</a></span>--%>
    </div>
</div>

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div id="myTabContent" class="tab-content">
                        <div class="tab-pane fade in active" id="allShip">
                            <table class="table" id="shipManager">
                                <thead>
                                    <th>船舶名称</th>
                                    <th>吨位</th>
                                    <th>实时位置</th>
                                    <th>运输状态</th>
                                    <th>船主电话</th>
                                    <th>操作</th>
                                </thead>
                                <tbody id="tbodyShip"></tbody>
                            </table>
                            <div class="row">
                                <div class="col-md-6" style="margin-top: 20px;">
                                    <div class="col-md-2">
                                        <select id="limit" name="limit">
                                            <option value="10">10条/页</option>
                                            <option value="20">20条/页</option>
                                            <option value="30">30条/页</option>
                                            <option value="40">40条/页</option>
                                            <option value="50">50条/页</option>
                                        </select>
                                    </div>
                                    <span id="summary"></span>
                                </div>
                                <div class="col-md-6" style="text-align: right">
                                    <input type="hidden" id="pagenum"/>
                                    <input type="hidden" id="pagesize"/>
                                    <ul id="pagination" class="pagination">
                                        <li id="homePage"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">首页</a></li>
                                        <li id="previousPage"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">上一页</a></li>
                                        <li id="nextPage"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">下一页</a></li>
                                        <li id="tailPage"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">最后一页</a></li>
                                        <li style="margin-left: 5px">跳转至<input id='page1' name='pages' type='text'size="6"/>页<input type='button' value='跳转' class="btn btn-default" style="margin-left: 5px;height: 26px" onclick='allShips($("#page1").val())'/></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="canVideo">
                            <table class="table" id="shipMonitoring">
                                <thead>
                                <th>船舶名称</th>
                                <th>吨位</th>
                                <th>实时位置</th>
                                <th>运输状态</th>
                                <th>船主电话</th>
                                <th>操作</th>
                                </thead>
                                <tbody id="tbodyMonitoring"></tbody>
                            </table>
                            <div class="row">
                                <div class="col-md-7">
                                    <div class="col-md-2">
                                        <select id="limitMonitoring" name="limitMonitoring">
                                            <option value="10">10条/页</option>
                                            <option value="20">20条/页</option>
                                            <option value="30">30条/页</option>
                                            <option value="40">40条/页</option>
                                            <option value="50">50条/页</option>
                                        </select>
                                    </div>
                                    <span id="summaryMonitoring"></span>
                                </div>
                                <div class="col-md-5" style="text-align: right">
                                    <input type="hidden" id="pagenumMonitoring"/>
                                    <input type="hidden" id="pagesizeMonitoring"/>
                                    <ul id="paginationMonitoring" class="pagination">
                                        <li id="homePageMonitoring"><a href="#" class="btn btn-default" style="height: 26px">首页</a></li>
                                        <li id="previousPageMonitoring"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">上一页</a></li>
                                        <li id="nextPageMonitoring"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">下一页</a></li>
                                        <li id="tailPageMonitoring"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">最后一页</a></li>
                                        <li>跳转至<input id='pageMonitoring' name='pages' type='text'size="6"/>页<input type='button' class="btn btn-default" style="height: 26px" value='GO' onclick='allShipsByMonitoring($("#pageMonitoring").val(),1)'/></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="authed">
                            <table class="table" id="shipCertified">
                                <thead>
                                <th>船舶名称</th>
                                <th>吨位</th>
                                <th>实时位置</th>
                                <th>运输状态</th>
                                <th>船主电话</th>
                                <th>操作</th>
                                </thead>
                                <tbody id="tbodyCertified"></tbody>
                            </table>
                            <div class="row">
                                <div class="col-md-7">
                                    <div class="col-md-2">
                                        <select id="limitCertified" name="limitCertified">
                                            <option value="10">10条/页</option>
                                            <option value="20">20条/页</option>
                                            <option value="30">30条/页</option>
                                            <option value="40">40条/页</option>
                                            <option value="50">50条/页</option>
                                        </select>
                                    </div>
                                    <span id="summaryCertified"></span>
                                </div>
                                <div class="col-md-5" style="text-align: right">
                                    <input type="hidden" id="pagenumCertified"/>
                                    <input type="hidden" id="pagesizeCertified"/>
                                    <ul id="paginationCertified" class="pagination">
                                        <li id="homePageCertified"><a href="#" class="btn btn-default" style="height: 26px">首页</a></li>
                                        <li id="previousPageCertified"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">上一页</a></li>
                                        <li id="nextPageCertified"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">下一页</a></li>
                                        <li id="tailPageCertified"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">最后一页</a></li>
                                        <li>跳转至<input id='pageCertified' name='pages' type='text'size="6"/>页<input class="btn btn-default" style="height: 26px" type='button' value='GO' onclick='allShipsByCertified($("#pageCertified").val(),1)'/></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="authing">
                            <table class="table" id="shipCertification">
                                <thead>
                                <th>船舶名称</th>
                                <th>吨位</th>
                                <th>实时位置</th>
                                <th>运输状态</th>
                                <th>船主电话</th>
                                <th>操作</th>
                                </thead>
                                <tbody id="tbodyCertification"></tbody>
                            </table>
                            <div class="row">
                                <div class="col-md-7">
                                    <div class="col-md-2">
                                        <select id="limitCertification" name="limitCertification">
                                            <option value="10">10条/页</option>
                                            <option value="20">20条/页</option>
                                            <option value="30">30条/页</option>
                                            <option value="40">40条/页</option>
                                            <option value="50">50条/页</option>
                                        </select>
                                    </div>
                                    <span id="summaryCertification"></span>
                                </div>
                                <div class="col-md-5" style="text-align: right">
                                    <input type="hidden" id="pagenumCertification"/>
                                    <input type="hidden" id="pagesizeCertification"/>
                                    <ul id="paginationCertification" class="pagination">
                                        <li id="homePageCertification"><a href="#" class="btn btn-default" style="height: 26px;">首页</a></li>
                                        <li id="previousPageCertification"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px;">上一页</a></li>
                                        <li id="nextPageCertification"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px;">下一页</a></li>
                                        <li id="tailPageCertification"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px;">最后一页</a></li>
                                        <li>跳转至<input id='pageCertification' name='pages' type='text'size="6"/>页<input type='button' class="btn btn-default" style="height: 26px" value='GO' onclick='allShipsByCertification($("#pageCertification").val(),0)'/></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="class1">
                            <a class="btn btn-primary" data-toggle="modal" data-target="#addShipNotClassificationShip" onclick="selectNotClassificationShips($('#page').val(),$('#classification').val())">+添加船舶</a>
                            <span class="deleteClassification" id="deleteClassification" style="font-size: 16px;margin-left: 20px;display: none"><a class="btn btn-default"onclick="deleteClassification()">删除分类</a></span>
                            <table class="table" id="classificationShip">
                                <thead>
                                <th>船舶名称</th>
                                <th>吨位</th>
                                <th>实时位置</th>
                                <th>运输状态</th>
                                <th>船主电话</th>
                                <th>操作</th>
                                </thead>
                                <tbody id="tbodyClassificationShip"></tbody>
                            </table>
                            <div class="row">
                                <div class="col-md-7">
                                    <div class="col-md-2">
                                        <select id="limitClassificationShip" name="limitClassificationShip">
                                            <option value="10">10条/页</option>
                                            <option value="20">20条/页</option>
                                            <option value="30">30条/页</option>
                                            <option value="40">40条/页</option>
                                            <option value="50">50条/页</option>
                                        </select>
                                    </div>
                                    <span id="summaryClassificationShip"></span>
                                </div>
                                <div class="col-md-5" style="text-align: right">
                                    <input type="hidden" id="pagenumClassificationShip"/>
                                    <input type="hidden" id="pagesizeClassificationShip"/>
                                    <input type="hidden" id="classificationId"/>
                                    <ul id="paginationClassificationShip" class="pagination">
                                        <li id="homePageClassificationShip"><a href="#" class="btn btn-default" style="height: 26px">首页</a></li>
                                        <li id="previousPageClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">上一页</a></li>
                                        <li id="nextPageClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">下一页</a></li>
                                        <li id="tailPageClassificationShip"><a href="#" class="btn btn-default" style="margin-left: 5px;height: 26px">最后一页</a></li>
                                        <li>跳转至<input id='pageClassificationShip' name='pages' type='text'size="6"/>页<input type='button' style="height: 36px" class="btn btn-default" value='GO' onclick='selectClassificationShip($("#pageClassificationShip").val(),$("#classificationId").val())'/></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<%--航行轨迹地图引入--%>
<script type="text/javascript" src='https://webapi.amap.com/maps?v=1.4.11&key=30556745e1796cbe4f69a621a8bc58bf'></script>
<!-- UI组件库 1.0 -->
<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>


<!-- 全局js -->
<script src="${pageContext.request.contextPath}/assets/shipui/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/assets/shipui/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/assets/shipui/js/content.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/assets/shipui/js/plugins/peity/jquery.peity.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/shipui/js/demo/peity-demo.js"></script>
<script src="${pageContext.request.contextPath}/assets/layui/layui.js" charset="utf-8"></script>
<script src="https://webapi.amap.com/maps?v=1.4.10&key=30556745e1796cbe4f69a621a8bc58bf&&plugin=AMap.Geocoder"></script>
<script src="${pageContext.request.contextPath}/assets/shipui/js/plugins/sweetalert/sweetalert.min.js"></script>

<script type="text/javascript">
    $(function() {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $(this).addClass("shipTabText-click");
        })
        allShips(1);
        selectClassification();
    });

    $(function () {
         var searchShipName = $("shipName").val();
         if (searchShipName !=""){
             $("body").keydown(function() {
                 if (event.keyCode == "13") {//keyCode=13是回车键
                     $('#searchShipButton').click();
                 }
             });
         }

    });

    function lnglat(lon,lat,shipId,x){
        var geocoder = new AMap.Geocoder({
            // city 指定进行编码查询的城市，支持传入城市名、adcode 和 citycode
            city: ''
        })
        var lnglat = [lon,lat];
        var address;
        geocoder.getAddress(lnglat, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                // result为对应的地理位置详细信息
                address= result.regeocode.addressComponent.province+result.regeocode.addressComponent.city+result.regeocode.addressComponent.district;
                geocoder_CallBack(address,shipId,x);
            }
        })
    }
    function geocoder_CallBack(data,shipId,x) {
        $("#address"+shipId+x).text(data);
    }
    <%--全部自有运力船舶--%>
    function allShips(page) {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $("#shipTabText").addClass("shipTabText-click");
            $("#deleteClassification").hide();
        });
        var data={
            shipName:$("#shipName").val(),
            startTon:$("#startTon").val(),
            endTon:$("#endTon").val(),
            page:page,
            limit:$('#limit').val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectAllShips.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var array =data.shipsList;
                var str="";
                var address="";
                if (data.SUCCESS==true){
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,0);
                        str+="<tr><td>"+array[i].shipName+"</td><td>"+array[i].tonnage+"</td><td><span id='address"+array[i].mmsi+"0'></span></td><td>"+array[i].navistat+"</td><td>"+array[i].phoneNum+"</td><td><a href='javascript:;'  class='shipClassText' onclick='sailingLog("+array[i].mmsi+")'>航行日志</a><a href='javascript:;' class='shipClassText'data-toggle='modal' data-target='#shipTrackModel' onclick='shipTrack("+array[i].mmsi+")'>轨迹</a><a href='javascript:;' class='shipClassTextDelete' onclick='deleteShip("+array[i].shipId+",1)'><i class=\"fa fa-trash-o\"></i></a></td></tr>";
                    })
                    $("#tbodyShip").html(str);
                    displayFooter(data.pageInfo);
                }else{
                    alert(data.MSG);
                }
            }
        });
    }

    function displayFooter(pageInfo) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summary").text(newText);
        $("#pagenum").val(pageInfo.pageNum);
        $("#pagesize").val(pageInfo.pages);
     };

    $("#homePage").click(function(){
        var pagenum = 1;
        allShips(pagenum);
    });

    $("#tailPage").click(function(){
        var pagenum =$("#pagenum").val();
        var pagesize =$("#pagesize").val();
        pagenum = pagesize;
        allShips(pagenum);
    });

    $("#previousPage").click(function(){
        var pagenum =$("#pagenum").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            allShips(pagenum);
        }
    });

    $("#nextPage").click(function(){
        var pagenum =$("#pagenum").val();
        var pagesize =$("#pagesize").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            allShips(pagenum);
        }
    });

    <%--有监控的船舶--%>
    function allShipsByMonitoring(page,monitoring) {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $(this).addClass("shipTabText-click");
            $("#deleteClassification").hide();
        });
        var data={
            monitoring:monitoring,
            page:page,
            limit:$('#limitMonitoring').val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectAllShips.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var array =data.shipsList;
                var str="";
                if (data.SUCCESS==true){
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,1);
                        str+="<tr><td>"+array[i].shipName+"</td><td>"+array[i].tonnage+"</td><td><span id='address"+array[i].mmsi+"1'></span></td><td>"+array[i].navistat+"</td><td>"+array[i].phoneNum+"</td><td><a href='javascript:;' class='shipClassText' ' onclick='sailingLog("+array[i].mmsi+")'>航行日志</a><a href='javascript:;' class='shipClassText' data-toggle='modal' data-target='#shipTrackModel' onclick='shipTrack("+array[i].mmsi+")'>轨迹</a><a href='javascript:;' class='shipClassTextDelete' onclick='deleteShip("+array[i].shipId+",2)'><i class=\"fa fa-trash-o\"></i></a></td></tr>";
                    })
                    $("#tbodyMonitoring").html(str);
                    displayFooterMonitoring(data.pageInfo);
                }else{
                    alert(data.MSG);
                }
            }
        });
    }
    function displayFooterMonitoring(pageInfo) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summaryMonitoring").text(newText);
        $("#pagenumMonitoring").val(pageInfo.pageNum);
        $("#pagesizeMonitoring").val(pageInfo.pages);
    };

    $("#homePageMonitoring").click(function(){
        var pagenum = 1;
        allShipsByMonitoring(pagenum,1);
    });

    $("#tailPageMonitoring").click(function(){
        var pagenum =$("#pagenumMonitoring").val();
        var pagesize =$("#pagesizeMonitoring").val();
        pagenum = pagesize;
        allShipsByMonitoring(pagenum,1);
    });

    $("#previousPageMonitoring").click(function(){
        var pagenum =$("#pagenumMonitoring").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            allShipsByMonitoring(pagenum,1);
        }
    });
    $("#nextPageMonitoring").click(function(){
        var pagenum =$("#pagenumMonitoring").val();
        var pagesize =$("#pagesizeMonitoring").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            allShipsByMonitoring(pagenum,1);
        }
    });

    <%--已认证的船舶--%>
    function allShipsByCertified(page,rzState) {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $(this).addClass("shipTabText-click");
            $("#deleteClassification").hide();
        })
        var data={
            rzState:rzState,
            page:page,
            limit:$('#limitCertified').val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectAllShips.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var array =data.shipsList;
                var str="";
                if (data.SUCCESS==true){
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,2);
                        str+="<tr><td>"+array[i].shipName+"</td><td>"+array[i].tonnage+"</td><td><span id='address"+array[i].mmsi+"2'></span></td><td>"+array[i].navistat+"</td><td>"+array[i].phoneNum+"</td><td><a href='javascript:;' class='shipClassText' onclick='sailingLog("+array[i].mmsi+")'>航行日志</a><a href='javascript:;' class='shipClassText' data-toggle='modal' data-target='#shipTrackModel' onclick='shipTrack("+array[i].mmsi+")'>轨迹</a><a href='javascript:;' class='shipClassTextDelete' onclick='deleteShip("+array[i].shipId+",3)'><i class=\"fa fa-trash-o\"></i></a></td></tr>";
                    })
                    $("#tbodyCertified").html(str);
                    displayFooterCertified(data.pageInfo);
                }else{
                    alert(data.MSG);
                }
            }
        });
    }

    function displayFooterCertified(pageInfo) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summaryCertified").text(newText);
        $("#pagenumCertified").val(pageInfo.pageNum);
        $("#pagesizeCertified").val(pageInfo.pages);
    };

    $("#homePageCertified").click(function(){
        var pagenum = 1;
        allShipsByCertified(pagenum,1);
    });

    $("#tailPageCertified").click(function(){
        var pagenum =$("#pagenumCertified").val();
        var pagesize =$("#pagesizeCertified").val();
        pagenum = pagesize;
        allShipsByCertified(pagenum,1);
    });

    $("#previousPageCertified").click(function(){
        var pagenum =$("#pagenumCertified").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            allShipsByCertified(pagenum,1);
        }
    });
    $("#nextPageCertified").click(function(){
        var pagenum =$("#pagenumCertified").val();
        var pagesize =$("#pagesizeCertified").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            allShipsByCertified(pagenum,1);
        }
    });


    <%--认证中的船舶--%>
    function allShipsByCertification(page,rzState) {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $(this).addClass("shipTabText-click");
            $("#deleteClassification").hide();
        });
        var data={
            rzState:rzState,
            page:page,
            limit:$('#limitCertification').val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectAllShips.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var array =data.shipsList;
                var str="";
                if (data.SUCCESS==true){
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,3);
                        str+="<tr><td>"+array[i].shipName+"</td><td>"+array[i].tonnage+"</td><td><span id='address"+array[i].mmsi+"3'></span></td><td>"+array[i].navistat+"</td><td>"+array[i].phoneNum+"</td><td><a href='javascript:;' class='shipClassText' onclick='sailingLog("+array[i].mmsi+")'>航行日志</a><a href='javascript:;' class='shipClassText' data-toggle='modal' data-target='#shipTrackModel' onclick='shipTrack("+array[i].mmsi+")'>轨迹</a><a href='javascript:;' class='shipClassTextDelete' onclick='deleteShip("+array[i].shipId+",4)'><i class=\"fa fa-trash-o\"></i></a></td></tr>";
                    })
                    $("#tbodyCertification").html(str);
                    displayFooterCertification(data.pageInfo);
                }else{
                    alert(data.MSG);
                }
            }
        });
    }

    function displayFooterCertification(pageInfo) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summaryCertification").text(newText);
        $("#pagenumCertification").val(pageInfo.pageNum);
        $("#pagesizeCertification").val(pageInfo.pages);
    };

    $("#homePageCertification").click(function(){
        var pagenum = 1;
        allShipsByCertification(pagenum,0);
    });

    $("#tailPageCertification").click(function(){
        var pagenum =$("#pagenumCertification").val();
        var pagesize =$("#pagesizeCertification").val();
        pagenum = pagesize;
        allShipsByCertification(pagenum,0);
    });

    $("#previousPageCertification").click(function(){
        var pagenum =$("#pagenumCertification").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            allShipsByCertification(pagenum,0);
        }
    });
    $("#nextPageCertification").click(function(){
        var pagenum =$("#pagenumCertification").val();
        var pagesize =$("#pagesizeCertification").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            allShipsByCertification(pagenum,0);
        }
    });
</script>
<script type="text/javascript">
    function selectClassification() {
        $.post("ylclassifcation/selectYLClassification.do",function (data) {
            if (data.SUCCESS == true){
                var array = data.ylClassificationDtoList;
                var str ="";
                $.each(array,function (i) {
                    str+=" <span class=\"shipTabText\" style=\"font-size: 16px;margin-left: 20px\"><a href=\"#class1\" data-toggle=\"tab\" onclick=\"selectClassificationShip($('#page').val(),"+array[i].classificationId+")\">"+array[i].classificationName+"</a></span>";
                })
                $("#ylClassification").html(str);
            }
        });
    }
    function selectClassificationShip(page,classificationId) {
        $(".shipTabText").click(function () {
            $(".shipTabText").removeClass("shipTabText-click");
            $(this).addClass("shipTabText-click");
            $("#classification").val(classificationId);
            $("#deleteClassification").show();
        });
        var data = {
            page:page,
            limit:$('#limitClassificationShip').val(),
            classificationId:classificationId
        }
        $.ajax({
            type : 'post',
            url : 'ylclassifcation/selectShipsByYLClassification.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var array =data.shipInfoDtoList;
                var str="";
                if (data.SUCCESS==true){
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,4);
                        str+="<tr><td>"+array[i].shipName+"</td><td>"+array[i].tonnage+"</td><td><span id='address"+array[i].mmsi+"4'></span></td><td>"+array[i].navistat+"</td><td>"+array[i].phoneNum+"</td><td><a href='javascript:;' class='shipClassText' onclick='sailingLog("+array[i].mmsi+")'>航行日志</a><a href='javascript:;' class='shipClassText' data-toggle='modal' data-target='#shipTrackModel' onclick='shipTrack("+array[i].mmsi+")'>轨迹</a><a href='javascript:;' class='shipClassTextDelete' onclick='deleteIYLShips("+array[i].shipId+")'><i class=\"fa fa-trash-o\"></i></a></td></tr>";
                    })
                    $("#tbodyClassificationShip").html(str);
                    displayFooterClassificationShip(data.pageInfo,classificationId);
                }else{
                    alert(data.MSG);
                }
            }
        });
    }
    function displayFooterClassificationShip(pageInfo,classificationId) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summaryClassificationShip").text(newText);
        $("#pagenumClassificationShip").val(pageInfo.pageNum);
        $("#pagesizeClassificationShip").val(pageInfo.pages);
        $("#classificationId").val(classificationId);
    };
    $("#homePageClassificationShip").click(function(){
        var pagenum = 1;
        selectClassificationShip(pagenum,$("#classificationId").val());
    });

    $("#tailPageClassificationShip").click(function(){
        var pagenum =$("#pagenumClassificationShip").val();
        var pagesize =$("#pagesizeClassificationShip").val();
        pagenum = pagesize;
        selectClassificationShip(pagenum,$("#classificationId").val());
    });

    $("#previousPageClassificationShip").click(function(){
        var pagenum =$("#pagenumClassificationShip").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            selectClassificationShip(pagenum,$("#classificationId").val());
        }
    });

    $("#nextPageClassificationShip").click(function(){
        var pagenum =$("#pagenumClassificationShip").val();
        var pagesize =$("#pagesizeClassificationShip").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            selectClassificationShip(pagenum,$("#classificationId").val());
        }
    });
    function addClassification() {
        var data = {
            classificationName:$("#classificationName").val()
        }
        $.ajax({
            type : 'post',
            url : 'ylclassifcation/insertYLClassificationQuery.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    $("#addClassification").modal('hide');
                    swal({
                        title: data.MSG,
                        text: "已新增",
                        type: "success"
                    });
                    // alert(data.MSG);
                    selectClassification();
                } else{
                    alert(data.MSG);
                }
            }
        });
    }

    function deleteClassification() {
        var data = {
            classificationId:$("#classification").val()
        }


        swal({
            title: "您确定要删除该分类吗？",
            // text: "计划终止后请去已中止计划里恢复！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false
        }, function () {
            $.ajax({
                type : 'post',
                url : 'ylclassifcation/deleteYLClassification.do',
                dataType : 'json',
                data:JSON.stringify(data),
                contentType: "application/json; charset=utf-8",
                async : false,
                success : function(data) {
                    if (data.SUCCESS ==true){
                        // alert(data.MSG);
                        // selectClassification();
                        location.href="toShipHome.do";
                    } else{
                        alert(data.MSG);
                    }
                }
            });
        });
    }


    function deleteIYLShips(shipId) {
        var data = {
            shipId:shipId,
            classificationId:$("#classification").val()
        }
        var r = confirm("确定删除该船舶吗?");
        if (r ==true) {
            $.ajax({
                type : 'post',
                url : 'ylships/deleteIYLShips.do',
                dataType : 'json',
                data:JSON.stringify(data),
                contentType: "application/json; charset=utf-8",
                async : false,
                success : function(data) {
                    if (data.SUCCESS ==true){
                        alert(data.MSG);
                        selectClassificationShip(1,$("#classification").val());
                    } else{
                        alert(data.MSG);
                    }
                }
            });
        }
    }
    
    function selectNotClassificationShips(page,classificationId) {
        var data = {
            page:page,
            limit:$('#limitNotClassificationShip').val(),
            shipName:$("#classShipName").val(),
            classificationId:classificationId
        }
        $.ajax({
            type : 'post',
            url : 'ylclassifcation/selectNotClassificationShips.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    var array =data.shipsList;
                    var str="";
                    $.each(array,function (i) {
                        lnglat(array[i].GLon,array[i].GLat,array[i].mmsi,5);
                        str+="<tr><td>"+array[i].shipName+"</td><td><span id='address"+array[i].mmsi+"5'></span></td><td>"+array[i].tonnage+"</td><td>"+array[i].navistat+"</td><td><a href='javascript:;' class='btn btn-sm btn-primary' onclick='addIYLShips("+array[i].shipId+")'>添加到分类</a></td></tr>";
                    })
                    $("#tbodyNotClassificationShip").html(str);
                    displayFooterNotClassificationShip(data.pageInfo,classificationId);
                } else{
                    alert(data.MSG);
                }
            }
        });
    }

    function displayFooterNotClassificationShip(pageInfo,classificationId) {
        <%--当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录--%>
        var newText = '共' + pageInfo.total + '条记录，' + '当前第' + pageInfo.pageNum + '页，' + '总共' + pageInfo.pages + '页';
        $("#summaryNotClassificationShip").text(newText);
        $("#pagenumNotClassificationShip").val(pageInfo.pageNum);
        $("#pagesizeNotClassificationShip").val(pageInfo.pages);
    };
    $("#homePageNotClassificationShip").click(function(){
        var pagenum = 1;
        selectNotClassificationShips(pagenum,$('#classification').val());
    });

    $("#tailPageNotClassificationShip").click(function(){
        var pagenum =$("#pagenumNotClassificationShip").val();
        var pagesize =$("#pagesizeNotClassificationShip").val();
        pagenum = pagesize;
        selectNotClassificationShips(pagenum,$('#classification').val());
    });

    $("#previousPageNotClassificationShip").click(function(){
        var pagenum =$("#pagenumNotClassificationShip").val();
        if(pagenum == 1){
            return false;
        } else{
            pagenum--;
            selectNotClassificationShips(pagenum,$('#classification').val());
        }
    });

    $("#nextPageNotClassificationShip").click(function(){
        var pagenum =$("#pagenumNotClassificationShip").val();
        var pagesize =$("#pagesizeNotClassificationShip").val();
        if(pagenum == pagesize){
            return false;
        } else{
            pagenum++;
            selectNotClassificationShips(pagenum,$('#classification').val());
        }
    });

    function addIYLShips(shipId) {
        var data = {
            shipId:shipId,
            classificationId:$("#classification").val()
        }
        $.ajax({
            type : 'post',
            url : 'ylships/insertIYLShipsQuery.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    alert(data.MSG);
                    selectNotClassificationShips($("#pagenumNotClassificationShip").val(),$('#classification').val());
                } else{
                    alert(data.MSG);
                }
            }
        });
    }

</script>

<script type="text/javascript">
    $("#radioShipName").click(function () {
        $("#shipNames").show();
        $("#mmsi").hide();
        $("#mmsi").val("");
    });
    $("#radioMmsi").click(function () {
        $("#shipNames").hide();
        $("#mmsi").show();
        $("#shipNames").val("");
    })

    function selectAllShipsByShipName() {
        var data ={
            shipName: $("#shipNames").val(),
            mmsi: $("#mmsi").val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectAllShipsByShipName.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var str="";
                if (data.SUCCESS ==true){
                    if (data.shipInfoDto ==null){
                        // alert("系统中没有该船舶，请去添加！");
                        $("#addBtn").show();

                        swal({
                            title: "系统中没有该船舶，请添加！",
                            type: "warning",
                            showCancelButton: true,
                            confirmButtonColor: "#DD6B55",
                            confirmButtonText: "确定",
                        },function () {

                            $("#shipName_1").val($('#shipNames').val());
                            $("#mmsi_1").val($('#mmsi').val());
                            $("#addShipInfo").modal('show');
                        });


                    }else{
                        lnglat(data.shipInfoDto.GLon,data.shipInfoDto.GLat,data.shipInfoDto.mmsi,6);
                        str="<tr><td>"+data.shipInfoDto.shipName+"</td><td><span id='address"+data.shipInfoDto.mmsi+"6'></span></td><td>"+data.shipInfoDto.tonnage+"</td><td>"+data.shipInfoDto.navistat+"</td><td><a href='javascript:;' class='btn btn-sm btn-primary'data-toggle='modal' data-target='#shipAndUser' onclick='inputValue("+data.shipInfoDto.shipId+")' >添加到自有运力</a></td></tr>";
                        $("#addBtn").hide();
                    }
                }else {
                    swal({
                        title: data.MSG,
                        type: "warning"
                    });
                    // alert(data.MSG);
                }
                $("#tbody").html(str);
            }
        });
    }

    function addValue() {
        $("#shipName_1").val($('#shipNames').val());
        $("#mmsi_1").val($('#mmsi').val());
    }

    function addShipInfo() {
        var data={
            shipName:$("#shipName_1").val(),
            mmsi:$("#mmsi_1").val(),
            tonnage:$("#tonnage").val(),
            shipOwnerName:$("#shipOwnerName").val(),
            phoneNum:$("#phoneNum").val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/insertShipInfo.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    $("#addShipInfo").modal('hide');
                    swal({
                        title: data.MSG,
                        type: "success"
                    })
                    // alert(data.MSG);
                }else {
                    swal({
                        title: data.MSG,
                        type: "warning"
                    });
                    // alert(data.MSG);
                }
            }
        });

    }
    function inputValue(shipId) {
        $("#shipId").val(shipId);
    }

    function addOrdernumber() {
        var shipList ={shipId: $("#shipId").val()};
        var data = {
            shipList:[shipList],
            consumeTypeId:$("input[name='time']:checked").val()
        }
        $.ajax({
            type : 'post',
            url : 'deductions/generatingOrder.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    $("#consumeId").val(data.consumeId);
                }else {
                    swal({
                        title: data.MSG,
                        text: "请按提示操作哦~",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "确定",
                        closeOnConfirm: false
                    }, function () {
                        window.location.href="toRecharge.do";
                    });
//                    alert(data.MSG);
                }
            }
        });
    }

    function addUserAndShip() {
        var shipList ={shipId: $("#shipId").val()};
        var data = {
            shipList:[shipList],
            consumeId:$("#consumeId").val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/insertShipAndByShipId.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                if (data.SUCCESS ==true){
                    $("#shipAndUser").modal('hide');

                    swal({
                        title: data.MSG,
                        type: "success"
                    });

                }else {
                    swal({
                        title: data.MSG,
                        type: "warning"
                    });
                    // alert(data.MSG);
                }
            }
        });

    }
</script>
<script type="text/javascript">
    function deleteShip(shipId,stste) {
        var data ={
            shipId:shipId
        };
        swal({
            title: "确定删除这条船吗？",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
        }, function () {
            $.ajax({
                type : 'post',
                url : 'ship/deleteShipsByShipid.do',
                dataType : 'json',
                data:JSON.stringify(data),
                contentType: "application/json; charset=utf-8",
                async : false,
                success : function(data) {
                    if (data.SUCCESS ==true){
                        // swal({
                        //     title: data.MSG,
                        //     type: "warning"
                        // });
                        if(stste==1){
                            allShips($("#pagenum").val());
                        }else if (stste==2){
                            allShipsByMonitoring($("#pagenumMonitoring").val(),1);
                        }else if (stste==3){
                            allShipsByCertified($("#pagenumCertified").val(),1)
                        }else if (stste==4){
                            allShipsByCertification($("#pagenumCertification").val(),0)
                        }
                    } else{
                        alert(data.MSG);
                    }
                }
            });
        });

        // var r = confirm("确定删除该自有运力吗?");
        // if (r ==true) {
        //     $.ajax({
        //         type : 'post',
        //         url : 'ship/deleteShipsByShipid.do',
        //         dataType : 'json',
        //         data:JSON.stringify(data),
        //         contentType: "application/json; charset=utf-8",
        //         async : false,
        //         success : function(data) {
        //             if (data.SUCCESS ==true){
        //                 alert(data.MSG);
        //                 if(stste==1){
        //                     allShips($("#pagenum").val());
        //                 }else if (stste==2){
        //                     allShipsByMonitoring($("#pagenumMonitoring").val(),1);
        //                 }else if (stste==3){
        //                     allShipsByCertified($("#pagenumCertified").val(),1)
        //                 }else if (stste==4){
        //                     allShipsByCertification($("#pagenumCertification").val(),0)
        //                 }
        //             } else{
        //                 alert(data.MSG);
        //             }
        //         }
        //     });
        // }

    }

    //航行轨迹时间筛选
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#timeSearch'
            , type: 'date'
            , range: true //或 range: '~' 来自定义分割字符
        });
    });
    //航行轨迹弹出模态框的方法
    function shipTrack(mmsi) {
        var data ={
            mmsi:mmsi,
            timeSearch:$("#timeSearch").val()
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectShipTrack.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                // console.log(data.trackList)
                if (data.SUCCESS ==true){

                    pathSimplifierIns.setData([{
                        path:data.trackList
                    }]);
                }else{
                    alert(data.MSG);
                }
                $("#timeSearch").val("");
            }
        });
        $('#trackMmsi').val(mmsi)
    }

//    筛选时间
    function searchTrack() {
        var timeSearch=$('#timeSearch').val();
        alert(timeSearch);
    }

//    航行日志
    function sailingLog(mmsi) {
        var data ={
            mmsi:mmsi
        }
        $.ajax({
            type : 'post',
            url : 'ship/selectShipSailLog.do',
            dataType : 'json',
            data:JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            async : false,
            success : function(data) {
                var str=""
                if (data.SUCCESS ==true) {
                    var array =data.records;
                    if(array.length>0){
                        $.each(array,function (i){
                            var arriveInfo ="";
                            if (array[i].arrive ==0){
                                arriveInfo ="到达"+array[i].portname_cn;
                            }else{
                                arriveInfo ="离开"+array[i].portname_cn;
                            }
                            str+="<div class=\"timeline-item\">" +
                                "<div class=\"row\"> " +
                                "<div class=\"col-xs-2 date\"> " +
                                "<i class=\"fa fa-ship\"></i> " +
                                "</div>" +
                                "<div class=\"col-xs-8 content\">" +
                                "<small style=\"font-weight: 800\">"+array[i].time+"</small> " +
                                "<p>"+arriveInfo+"</p> " +
                                "</div> " +
                                "</div> " +
                                "</div>"
                        })
                        $("#item").html(str);
                        $('#sailingLogModel').modal('show');
                    }else{
                        swal({
                            title: "该船舶七天内没有船舶日志!",
                            type: "success"
                        });
                    }

                }else {
                    alert(data.MSG);
                }
            }
        });
    }
</script>

<script type="text/javascript">

    var map = new AMap.Map('container', {
        zoom: 4,
        features: ['bg','point']
    });

    AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function(PathSimplifier, $) {

        if (!PathSimplifier.supportCanvas) {
            alert('当前环境不支持 Canvas！');
            return;
        }

        var pathSimplifierIns = new PathSimplifier({
            zIndex: 100,
            //autoSetFitView:false,
            map: map, //所属的地图实例

            getPath: function(pathData, pathIndex) {
                var data = [];
                for(var i =0;i<pathData.path.length;i++){
                    // console.log(pathData.path[i].lnglat)
                    data.push(pathData.path[i].lnglat)
                }
                return data;
            },
            getHoverTitle: function(pathData, pathIndex, pointIndex) {
                //设置展示title
                if (pointIndex >= 0) {
                    return pathData.path[pointIndex].name;
                }

                return pathData.name + '，点数量' + pathData.path.length;
            },
            renderOptions: {

                renderAllPointsIfNumberBelow: 100 //绘制路线节点，如不需要可设置为-1
            }
        });

        window.pathSimplifierIns = pathSimplifierIns;

        //设置数据


        //对第一条线路（即索引 0）创建一个巡航器
            navg1 = pathSimplifierIns.createPathNavigator(0, {
            loop: true, //循环播放
            speed: 1000000 //巡航速度，单位千米/小时
        });

        navg1.start();
    });


//    计费选择的模态框

    $(function() {

        $(".year").click(function(){
            $(".pay-fee-ship").removeClass("pay-fee-click");
            $(this).addClass("pay-fee-click");
        })

        $(".month").click(function(){
            $(".pay-fee-ship").removeClass("pay-fee-click");
            $(this).addClass("pay-fee-click");
        })

    });
</script>
</body>

</html>
